Skip to content

Add sha256 object format support#140

Open
linsein wants to merge 2 commits into
gogs:v2from
linsein:feat-sha256
Open

Add sha256 object format support#140
linsein wants to merge 2 commits into
gogs:v2from
linsein:feat-sha256

Conversation

@linsein

@linsein linsein commented Jul 8, 2026

Copy link
Copy Markdown

Describe the pull request

Link to the issue: #138

ObjectFormat struct

  • Add the ObjectFormat struct.
  • Add the *Repository.ObjectFormat method.
  • Add an ObjectFormat member to the InitOption struct

Oid interface

  • Add the Oid interface to represent the Object ID of a Git repository.
  • Add the SHA256 struct.
  • Replace *SHA1 with Oid in other struct fields, method parameters, and return types.
  • Rename the file sha1.go to oid.go.

Add SHA256 Repository testing

  • Add the test_sha256 build tag to control testing variables and constants.
  • Replace hard-coded hashes with the testrepoMarks map.

Others

  • Fix TestReceivePack and TestUploadPack failures occurring on Git client v2.54.0 by updating the string matching patterns.

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code.

@linsein linsein requested a review from a team as a code owner July 8, 2026 05:50
@linsein

linsein commented Jul 8, 2026

Copy link
Copy Markdown
Author

Just noticed that the sha256 object format was experimentally supported in Git 2.29 and marked as stable in 2.51.
If using a version of Git earlier than 2.29, users will get error: unknown option 'object-format=sha256'.

Should I give a friendlier error message? Or is it too early to add sha256 support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant